""" Models.AdminConfig Model """

from masoniteorm.models import Model
from masoniteorm.collection import Collection


class AdminConfig(Model):
    """Models.AdminConfig Model"""
    __timestamps__ = False
    FIELDS = {
        'watermark_switch': {0: '关', 1: '开'}
    }

    @classmethod
    def generate_log(cls, title, content, remark):
        """
        生成日志
        @param string title:
        @param string content:
        @param string remark:
        @return: None
        """
        cls.create({
            'title': title,
            'content': content,
            'remark': remark
        })

    @classmethod
    def get_config(cls):
        """
        获取配置
        @return: {'website': '网站名称', 'bei_an': '备案号', 'copyright': '版权信息', 'watermark_switch': '1'}
        """
        return Collection(cls.get()).pluck('content', 'title').all()